package iosr11.data;

import java.util.ArrayList;
import java.util.List;

public class User extends Entity{
	private String name;
	private String email;
	private List<Group> groups;
	
	public User(){
		groups = new ArrayList<Group>();
	}
	
	public User(String id, String name, String email){
		super(id);
		this.name = name;
		this.email = email;
		groups = new ArrayList<Group>();
	}
	
	public User(String id, String name, String email, List<Group> groups){
		super(id);
		this.name = name;
		this.email = email;
		this.groups = groups;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public List<Group> getGroups() {
		return groups;
	}

	public void setGroups(List<Group> groups) {
		this.groups = groups;
	}
	
	public void addGroup(Group group){
		if (this.groups==null) 
			this.groups=new ArrayList<Group>();
		this.groups.add(group);
	}
	
	public void deleteGroup(Group group){
		this.groups.remove(group);
	}
}
